package gof.com.yew.observer;

public class ObserverDemo02 {
	
	public static void main(String[] args) {
		TargetObject t = new TargetObject();
		ObserverB ob1 = new ObserverB();
		ObserverB ob2 = new ObserverB();
		ObserverB ob3 = new ObserverB();
		 t.addObserver(ob1);
		 t.addObserver(ob2);
		 t.addObserver(ob3);
		 t.setState("red");
		 System.out.println(ob1.getState());
		 System.out.println(ob2.getState());
		 System.out.println(ob3.getState());
		 System.out.println("---------------------------------------");
		 t.setState("blue");
		 System.out.println(ob1.getState());
		 System.out.println(ob2.getState());
		 System.out.println(ob3.getState());
	}

}
